package com.sanben.gift.constants

import androidx.core.content.edit
import com.zhilingshenghuo.app.zhly.AndroidApplication

import org.jetbrains.anko.defaultSharedPreferences

object UserModel {
    var userId: String
        get() {
            //40285681699f00d101699f00d3930003
            return AndroidApplication.getContext().defaultSharedPreferences.getString("userId", "")!!
        }
        set(value) = AndroidApplication.getContext().defaultSharedPreferences.edit {
            putString("userId", value)
        }

    var headImg: String
        get() {
            return AndroidApplication.getContext().defaultSharedPreferences.getString("headImg", "")!!
        }
        set(value) {
            AndroidApplication.getContext().defaultSharedPreferences.edit {
                putString("headImg", value)
            }
        }

    var nickName: String
        get() {
            return AndroidApplication.getContext().defaultSharedPreferences.getString("nickName", "")!!
        }
        set(value) {
            AndroidApplication.getContext().defaultSharedPreferences.edit {
                putString("nickName", value)
            }
        }

    var prizeCount:Int
        get() {
            return AndroidApplication.getContext().defaultSharedPreferences.getInt("prizeCount", 0)
        }
        set(value) {
            AndroidApplication.getContext().defaultSharedPreferences.edit {
                putInt("prizeCount", value)
            }
        }

    var shopId: String
        get() {
            return AndroidApplication.getContext().defaultSharedPreferences.getString("shopId", "")!!
        }
        set(value) {
            AndroidApplication.getContext().defaultSharedPreferences.edit {
                putString("shopId", value)
            }
        }
    var userRole:Int
        get() {
            return AndroidApplication.getContext().defaultSharedPreferences.getInt("userRole", 0)
        }
        set(value) {
            AndroidApplication.getContext().defaultSharedPreferences.edit {
                putInt("userRole", value)
            }
        }

    var history: String
        get() {
            //40285681699f00d101699f00d3930003
            return AndroidApplication.getContext().defaultSharedPreferences.getString("history", "")!!
        }
        set(value) = AndroidApplication.getContext().defaultSharedPreferences.edit {
            putString("history", value)
        }
}